<template>
	<!-- 我的信息 -->
	<view>
		<view class="" style="padding: 26rpx 30rpx 0rpx ;">
			<view class="" style="padding-bottom: 36rpx;" @click="phonenum">
				<x-cell :leftslot="true" :rightslot="true">
					<view class="d-flex" slot="lefttext">
						<view class="" style="margin-right: 38rpx;">
							电话号码
						</view>
						<view class="" style="color: #B7B7B7;">
							{{userinfo.phone}}
						</view>
					</view>
					<view class="d-flex" slot="righttext">
						<view class="">
							<image src="../../static/icon/right_jian.png" mode="" style="width: 14rpx;height: 24rpx">
							</image>
						</view>
					</view>
				</x-cell>
			</view>
			<u-line color="info" border-style="solid" />
			<view class="" style="padding: 26rpx 0rpx 34rpx;" @click="setMyMessage">
				<x-cell :leftslot="true" :rightslot="true">
					<view class="d-flex" slot="lefttext">
						<view class="" style="margin-right: 38rpx;">
							个人信息
						</view>
						<view class="" style="color: #B7B7B7;">
							{{uname}},{{userinfo.sex}}
						</view>
					</view>
					<view class="d-flex" slot="righttext">
						<view class="">
							<image src="../../static/icon/right_jian.png" mode="" style="width: 14rpx;height: 24rpx">
							</image>
						</view>
					</view>
				</x-cell>
			</view>
			<u-line color="info" border-style="solid" />
		</view>
	</view>
</template>
<script>
	// 获取个人信息
	import {
		userInfo
	} from '@/config/apiRouter.js'
	import {
		mapGetters
	} from 'vuex'
	export default {
		data() {
			return {
				phone: '', //手机号码
				username: '', //姓名
				sex: '', //性别
			}
		},
		onShow() {
			// this.userInfoview()
			console.log(this.userinfo, 'ewfe');
		},
		computed: {
			...mapGetters(['uname', 'userinfo'])
		},
		methods: {
			// 绑定手机号
			phonenum() {
				uni.navigateTo({
					url: '../setSubmitPhoneNum/setSubmitPhoneNum?phonenum=' + this.userinfo.phone
				})
				// if (this.userinfo.phone) {
				// 	console.log('有手机号去换绑')
				// 	// 验证旧的手机号界面
				// 	// uni.navigateTo({
				// 	// 	url: '../setPhoneNum/setPhoneNum?phonenum=' + this.userinfo.phone
				// 	// })

				// 	// 不需要验证码直接跳过验证旧的界面  直接去换绑
				// 	uni.navigateTo({
				// 		url: '../setSubmitPhoneNum/setSubmitPhoneNum?phonenum=' + this.userinfo.phone
				// 	})
				// } else {
				// 	// 没有电话号码去绑定
				// 	console.log('没有电话号码去绑定')
				// 	uni.navigateTo({
				// 		url: '../bindPhoneNum/bindPhoneNum'
				// 	})
				// }

			},
			// 更换性别 姓名
			setMyMessage() {
				uni.navigateTo({
					url: '../setMyMessage/setMyMessage'
				})
			},
			// 获取用户信息
			userInfoview() {
				userInfo().then(res => {
					this.phone = res.data.phone;
					this.username = res.data.username;
					this.sex = res.data.sex;
					console.log(res, '获取用户的信息')
				})
			}
		}
	}
</script>

<style>

</style>
